import axios from "axios";

// 生成默认话术
export const generateDefaultScript = async (params) => {
  return axios
    .post(
      // "https://qianfan.baidubce.com/v2/chat/completions", //百度
      "https://api.deepseek.com/chat/completions", //deepseek
      {
        model: "deepseek-chat",
        // model: "ernie-lite-8k",
        // max_tokens: 2048,
        // temperature: 1.3,
        ...params,
      },
      {
        headers: {
          "Content-Type": "application/json", // 设置请求头为 JSON
          Authorization: "Bearer sk-e81b62e0001c456b80cea9a0540d5a1c",
          // Authorization: "Bearer bce-v3/ALTAK-OlfH4caCRjVRsvdn3toP9/6ba6ca6b5a3b345bd24e8c66ab2c4459512ac206",
        },
      }
    )
    .then((res) => {
      console.log('res---', res);
      return res.data;
    })
    .catch((err) => {
      console.log("err---", err);
      return err;
    });
};

// 文本转音频
export const textToAudio = async (params) => {
  return axios
    .post("http://127.0.0.1:9670/synthesize", {
      ...params,
    })
    .then((res) => {
      return res.data;
    }).catch((err) => {
      return err;
    });;
};
